package com.atguigu.srb.core.controller.admin;


import com.atguigu.common.result.R;
import com.atguigu.srb.core.pojo.entity.UserLoginRecord;
import com.atguigu.srb.core.service.UserLoginRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 用户登录记录表 前端控制器
 * </p>
 *
 * @author 龙龙龙
 * @since 2022-01-21
 */
@RestController
@RequestMapping("/admin/core/userLoginRecord")
//@CrossOrigin
@Slf4j
@Api(tags = "用户登入日志列表")
public class AdminUserLoginRecordController {

    @Autowired
    private UserLoginRecordService userLoginRecordService;


    @ApiOperation("查询登录日志")
    @GetMapping("/getUserLoginRecordTop50/{id}")
    public R getUserLoginRecordTop50(
            @ApiParam(value = "用户id", required = true)
            @PathVariable("id") Long id){

        List<UserLoginRecord> userLoginRecord = userLoginRecordService.getUserLoginRecordTop50(id);
        return R.ok().data("list", userLoginRecord);
    }
}

